package com.ruoyi.ap.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ap.mapper.VillageMapper;
import com.ruoyi.ap.domain.Village;
import com.ruoyi.ap.service.IVillageService;

import javax.annotation.Resource;

/**
 * 村庄Service业务层处理
 * 
 * @author HuaQP
 * @date 2023-09-11
 */
@Service
public class VillageServiceImpl implements IVillageService 
{
    @Resource
    private VillageMapper villageMapper;

    /**
     * 查询村庄
     * 
     * @param id 村庄主键
     * @return 村庄
     */
    @Override
    public Village selectVillageById(Long id)
    {
        return villageMapper.selectVillageById(id);
    }

    /**
     * 查询村庄列表
     * 
     * @param village 村庄
     * @return 村庄
     */
    @Override
    public List<Village> selectVillageList(Village village)
    {
        return villageMapper.selectVillageList(village);
    }

    @Override
    public List<Village> selectVillageAll() {
        return villageMapper.selectVillageAll();
    }

    /**
     * 新增村庄
     * 
     * @param village 村庄
     * @return 结果
     */
    @Override
    public int insertVillage(Village village)
    {
        village.setCreateTime(DateUtils.getNowDate());
        return villageMapper.insertVillage(village);
    }

    /**
     * 修改村庄
     * 
     * @param village 村庄
     * @return 结果
     */
    @Override
    public int updateVillage(Village village)
    {
        village.setUpdateTime(DateUtils.getNowDate());
        return villageMapper.updateVillage(village);
    }

    /**
     * 批量删除村庄
     * 
     * @param ids 需要删除的村庄主键
     * @return 结果
     */
    @Override
    public int deleteVillageByIds(Long[] ids)
    {
        return villageMapper.deleteVillageByIds(ids);
    }

    /**
     * 删除村庄信息
     * 
     * @param id 村庄主键
     * @return 结果
     */
    @Override
    public int deleteVillageById(Long id)
    {
        return villageMapper.deleteVillageById(id);
    }
}
